﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PKURG.CostSplit.Business.QueryBase;

namespace PKURG.CostSplit.Business
{
    public class BusinessTypeArea
    {
        //usp_n_GetStageAreaList
        public static List<dynamic> GetStageAreaList(string projectStageId)
        {
            return ExecuteQuery.GetList(
                new QueryBase.QueryInfo()
                {
                    ProcName = "usp_n_GetStageAreaList",
                    Params = { projectStageId }
                });
        }
        /// <summary>
        /// 平安夜前新增四个面积
        /// </summary>
        /// <param name="stageId"></param>
        /// <param name="id"></param>
        /// <param name="tbBuildingCount"></param>
        /// <param name="tbZD_Area"></param>
        /// <param name="tbJZ_Area"></param>
        /// <param name="tbJZ_U_Area"></param>
        /// <param name="tbJZ_D_Area"></param>
        /// <param name="tbXS_Area"></param>
        /// <param name="tbXS_U_Area"></param>
        /// <param name="tbXS_D_Area"></param>
        /// <param name="tbMixArea"></param>
        /// <param name="tbMixAreaD2"></param>
        /// <param name="tbMixAreaD3"></param>
        /// <param name="tbMixAreaD6"></param>
        /// <returns></returns>
        public static int UpdateInfo(string stageId, string id, string tbBuildingCount, string tbZD_Area, string tbJZ_Area, string tbJZ_U_Area,
            string tbJZ_D_Area, string tbXS_Area, string tbXS_U_Area, string tbXS_D_Area
            , string tbMixArea, string tbMixAreaD2, string tbMixAreaD3, string tbMixAreaD6)
        {
            return QueryBase.CustomProcess.ExecuteProcNonQuery("usp_n_UpDateBusinessTypeArea",
    new Object[] {stageId, id, tbBuildingCount, tbZD_Area, tbJZ_Area, tbJZ_U_Area, tbJZ_D_Area, tbXS_Area,
tbXS_U_Area,tbXS_D_Area,
 tbMixArea,  tbMixAreaD2,  tbMixAreaD3,  tbMixAreaD6
    });
        }


        public static int SyncStageArea(string projectStageId)
        {
            return CustomProcess.ExecuteProcNonQuery("usp_n_SyncArea_Cursor", new Object[] { projectStageId });
        }

        //usp_n_GetStageAreaList
        public static List<dynamic> GetApportionAreaType()
        {
            return ExecuteQuery.GetList(
                new QueryBase.QueryInfo()
                {
                    ProcName = "usp_n_GetApportionAreaType",
                    Params = { }
                });
        }

        public static dynamic GetApportionAreaTypeInfo(int id)
        {
            List<dynamic> infos = ExecuteQuery.GetList(
                new QueryBase.QueryInfo()
                {
                    ProcName = "usp_n_GetApportionAreaTypeInfo",
                    Params = { id }
                });
            if (infos.Count > 0)
            {
                return infos[0];
            }
            return null;
        }

        public static dynamic GetStageAreaModfiyHistoryList(string stageId, string formatID)
        {
            List<dynamic> infos = ExecuteQuery.GetList(
                new QueryBase.QueryInfo()
                {
                    ProcName = "usp_n_GetStageAreaModfiyHistory",
                    Params = { stageId, formatID }
                });
            return infos;
        }

        public static dynamic GetStageAreaModfiyHistoryTopInfo(string stageId, string formatID)
        {
            List<dynamic> infos = GetStageAreaModfiyHistoryList(stageId, formatID);
            if (infos.Count > 0)
            {
                return infos[0];
            }
            return null;
        }

        public static int AddStageAreaModfiyHistory(string stageId, string formatID, string txt, string colName, string src, string des)
        {
            return QueryBase.CustomProcess.ExecuteProcNonQuery("usp_n_AddStageAreaModfiyHistory",
                    new Object[] { stageId, formatID, txt, colName, src, des });
        }
    }
}
